<template>
  <div class="modal-overlay" @click="closeModal">
    <div class="modal-content" @click.stop>
      <!-- 关闭按钮 -->
      <img 
        src="@/assets/images/home/xx.png" 
        alt="关闭" 
        class="close-btn"
        @click="closeModal"
      />
      
      <!-- 弹窗内容 -->
      <div class="modal-body">
        <!-- 标题 -->
        <h2 class="modal-title">分类管理</h2>
        
        <!-- 文件夹选项 -->
        <div class="form-group">
          <label class="form-label">文件夹选项：</label>
          <select class="form-select">
            <option value="">无</option>
            <option value="folder1">文件夹1</option>
            <option value="folder2">文件夹2</option>
          </select>
        </div>
        
        <!-- 文件夹名称 -->
        <div class="form-group">
          <label class="form-label">文件夹名称：</label>
          <input 
            type="text" 
            class="form-input"
            placeholder="请输入文件夹名称"
            v-model="folderName"
          />
        </div>
        
         <!-- 排序 -->
         <div class="form-group">
           <label class="form-label">排序：</label>
           <input 
             type="text" 
             class="form-input"
             placeholder="请输入排序,数字越小越靠前"
             v-model="sortOrder"
           />
         </div>
        
        <!-- 按钮组 -->
        <div class="button-group">
          <button class="cancel-btn" @click="closeModal">取消</button>
          <button class="confirm-btn" @click="handleConfirm">确定</button>
        </div>
      </div>
    </div>
  </div>
</template>

<script setup>
import { ref } from 'vue'

// 定义事件
const emit = defineEmits(['close'])

// 表单数据
const folderName = ref('')
const sortOrder = ref('')

// 关闭弹窗
const closeModal = () => {
  emit('close')
}

// 处理确定
const handleConfirm = () => {
  // 这里可以添加确认逻辑
  console.log('分类管理信息:', { 
    folderName: folderName.value, 
    sortOrder: sortOrder.value 
  })
  closeModal()
}
</script>

<style lang="scss" scoped>
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-content {
  width: 651px;
  height: 498px;
  background: #FFFFFF;
  border-radius: 20px;
  position: relative;
  display: flex;
  flex-direction: column;
}

.close-btn {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 31px;
  height: 31px;
  cursor: pointer;
  z-index: 1001;
  
  &:hover {
    opacity: 0.8;
  }
}

.modal-body {
  flex: 1;
  padding: 32px 60px 40px 60px;
  display: flex;
  flex-direction: column;
  align-items: center;
  box-sizing: border-box;
}

.modal-title {
  font-family: 'Alibaba PuHuiTi';
  font-weight: 500;
  font-size: 26px;
  color: #313030;
  margin: 0 0 47px 0;
  text-align: center;
}

.form-group {
  width: 100%;
  display: flex;
  align-items: center;
  margin-bottom: 18px;
  
  &:last-of-type {
    margin-bottom: 39px;
  }
}

.form-label {
  font-family: 'Alibaba PuHuiTi';
  font-weight: 400;
  font-size: 18px;
  color: #343434;
  white-space: nowrap;
  margin-right: 45px;
  min-width: 120px;
}

.form-select {
  width: 398px;
  height: 65px;
  background: #FFFFFF;
  border-radius: 10px;
  border: 1px solid #E1E1E1;
  padding: 0 20px 0 29px;
  font-family: 'Alibaba PuHuiTi';
  font-weight: 400;
  font-size: 18px;
  color: #343434;
  outline: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%23C3C3C3' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 20px center;
  background-size: 17px 11px;
  
  &:focus {
    border-color: #004BB2;
  }
  
  option {
    color: #343434;
  }
}

.form-input {
  width: 398px;
  height: 65px;
  background: #FFFFFF;
  border-radius: 10px;
  border: 1px solid #E1E1E1;
  padding: 0 20px 0 29px;
  font-family: 'Alibaba PuHuiTi';
  font-weight: 400;
  font-size: 18px;
  color: #343434;
  outline: none;
  
  &::placeholder {
    color: #B7B7B7;
  }
  
  &:focus {
    border-color: #004BB2;
  }
}

.button-group {
  display: flex;
  gap: 32px;
  justify-content: center;
  margin-top: 20px;
  margin-left: 130px;
}

.cancel-btn {
  width: 154px;
  height: 55px;
  background: #E4E4E4;
  border-radius: 10px;
  border: none;
  font-family: 'Alibaba PuHuiTi';
  font-weight: 400;
  font-size: 20px;
  color: #313030;
  cursor: pointer;
  transition: background 0.3s ease;
  
  &:hover {
    background: #D4D4D4;
  }
}

.confirm-btn {
  width: 154px;
  height: 55px;
  background: #004BB2;
  border-radius: 10px;
  border: none;
  font-family: 'Alibaba PuHuiTi';
  font-weight: 400;
  font-size: 20px;
  color: #FFFFFF;
  cursor: pointer;
  transition: background 0.3s ease;
  
  &:hover {
    background: #003A9A;
  }
}
</style>
